<?php 
require("class.phpmailer.php");

$date = date ("l, F jS, Y"); 
$time = date ("H:i:s");
$credit = $_POST['credit'];
$submitter = $_POST['submitter'];
$email = $_POST['email'];

if ( $submitter == "" ) { $submitter = "anonymous"; }
if ( $email == "" ) { $email = "noreply@email.com"; }

$msg = "====================================================\n";
$msg .= "Date: $date at $time\n";
$msg .= "Credit submitter: $credit\n";
$msg .= "Submitted by: $submitter\n";
$msg .= "E-mail: $email\n";
$msg .= "====================================================\n\n";
$msg .= $_POST['question'];
$msg .= "\n\n";

$body = preg_replace( "/\n/", "<br>", $msg );

$mail = new PHPMailer();

$mail->IsSMTP();				// set mailer to use SMTP
$mail->Host = "smtp.emich.edu";	// specify main and backup server
$mail->SMTPAuth = true;     	// turn on SMTP authentication
$mail->Username = "asteichm";  	// SMTP username
$mail->Password = "Lcelb1OKg"; 	// SMTP password

$mail->From = $email; 
$mail->FromName = $submitter;

$mail->Subject = "Korean Quiz Submission";
$mail->AltBody = $msg;
$mail->MsgHTML($body);
$mail->AddAddress("asteichm@emich.edu", "Ann Marie Steichmann");

include("header.php"); 

if (!$mail->Send()) {
	echo '<p>Submission failed.  Please try again later.</p>';
} else {
	echo '<p>Thank you for your submission.  It will be posted once it has been reviewed.<p>';
}
?>
<a href="#" onclick="javascript:window.close();">Close</a>
<?php include("footer.php");
 

